home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 007 / c80tcog.lbr / PUTGET.C < prev    next >
Text File  |  1985-08-09  |  896b  |  47 lines

  1. /*
  2.     Kernighan & Ritchie, "The C Programming
  3. Language", Prentice-Hall, Inc. Englewood Cliffs, NJ
  4. 1978, p. 155.
  5.  
  6.     submitted by    William G. Hutchison, Jr.
  7.             P.O. Box 278
  8.             Exton, PA 19341-0278
  9.             U.S.A.
  10.  
  11.             CompuServe 70665,1307
  12.  */
  13.  
  14.  
  15. #define    MAXLINE    1000    /* maximum input line size */
  16. #include "gets.c"
  17. #define MAINLY
  18. #ifdef MAINLY
  19. #else
  20. #endif
  21.  
  22. /* puts - put a string to stdout, appending a newline at the end */
  23.  
  24. puts(s) char *s;
  25. {
  26.         while (*s) putchar(*s++); 
  27.         putchar(NEWLINE);
  28. }
  29. /* end puts */
  30.  
  31. /* fputs - copy string s to output stream                       */
  32.  
  33. fputs(s, stream) char *s; 
  34. FILE *stream;
  35. {
  36.         while(*s) putc(*s++, stream);
  37. } /* end fputs */
  38.  
  39. main()    /* test driver: copy input lines to standard output */
  40. {
  41. char L[MAXLINE];
  42. char *s;
  43.  
  44. while ((s= gets(L, MAXLINE)) != NULL)
  45.     puts(L);
  46. }            /* end main        */
  47.